{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Stacked Barplot"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A function to conveniently plot stacked bar plots in matplotlib using pandas `DataFrame`s. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> from mlxtend.plotting import category_scatter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Overview"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A matplotlib convenience function for creating barplots from DataFrames where each sample is associated with several categories."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### References\n",
    "\n",
    "- -"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 - Stacked Barplot from Pandas DataFrames"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>X1</th>\n",
       "      <th>X2</th>\n",
       "      <th>X3</th>\n",
       "      <th>X4</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Sample1</th>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sample2</th>\n",
       "      <td>1.4</td>\n",
       "      <td>2.1</td>\n",
       "      <td>2.9</td>\n",
       "      <td>5.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sample3</th>\n",
       "      <td>1.9</td>\n",
       "      <td>2.2</td>\n",
       "      <td>3.5</td>\n",
       "      <td>4.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sample4</th>\n",
       "      <td>1.4</td>\n",
       "      <td>2.5</td>\n",
       "      <td>3.5</td>\n",
       "      <td>4.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          X1   X2   X3   X4\n",
       "Sample1  1.0  2.0  3.0  4.0\n",
       "Sample2  1.4  2.1  2.9  5.1\n",
       "Sample3  1.9  2.2  3.5  4.1\n",
       "Sample4  1.4  2.5  3.5  4.2"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "s1 = [1.0, 2.0, 3.0, 4.0]\n",
    "s2 = [1.4, 2.1, 2.9, 5.1]\n",
    "s3 = [1.9, 2.2, 3.5, 4.1]\n",
    "s4 = [1.4, 2.5, 3.5, 4.2]\n",
    "data = [s1, s2, s3, s4]\n",
    "\n",
    "df = pd.DataFrame(data, columns=['X1', 'X2', 'X3', 'X4'])\n",
    "df.columns = ['X1', 'X2', 'X3', 'X4']\n",
    "df.index = ['Sample1', 'Sample2', 'Sample3', 'Sample4']\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "By default, the index of the `DataFrame` is used as column labels, and the `DataFrame` columns are used for the plot legend."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA8QAAAImCAYAAACVV0PKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzs3X2YXWV9L/zvjSGQ0XSiBCVpC0XxBZAeOwEqUrH1eFqa\n+lYFNWqqVR4akzyRCMWWl6Y2cHhpS2KLBY6PVYoaa6EcBAmxaBWqVR+JbbHG0/oIEpUAg8nYsEMy\ngfv5YyZxEkLIzO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npaNm58tKN1PPOZB+e2264fUSi+4oorcuutt2bBggW5/fbbd26/\n5557snz58px++umZO3dukuSqq67K2rVrc8IJJ+THP/5x2+ofLoEYAACgwzZt2pSNGx/N1KnLc9BB\nR3akhq1b78nGjRdm06ZNIwrEhx56aC677LKceeaZue666zJ//vwkycKFCzN16tSsXLly574f//jH\n87M/+7NJkuOOO649v8AICMQAAAATxEEHHZmDD35Rx15/27bRHX/GGWfk2muvzTnnnJNXv/rVWbNm\nTdasWZMrr7wys2bN2rnfjjDcaQIxAAAAbXPNNdekp6cnCxYsyJ133pkTTzwxCxcu7HRZeyQQAwAA\n0DbHHHNMzj777FxyySWZMmVKVq9e3emSnpRllwAAAGirmTNnJklmz56dY489tsPVPDmBGAAAgLZZ\nv359li1bluOOOy7r16/P5Zdf3umSnpRADAAAQNssXrw4pZSsXr06p512Wi6++OLce++9nS5rjwRi\nAAAA2uLGG2/MzTffnIsuuiizZ8/OypUrc+CBB2bRokWdLm2PBGIAAABGbfPmzVmyZEnmzJmTxYsX\nJ0lmzZqV5cuX57bbbssNN9zQ4QqfyCzTAAAAE8TWrfdM2tc+//zzs2HDhtx0000ppezcvmjRolx7\n7bU566yzcuqpp+bpT3967rzzztxxxx2pteahhx5Kq9XKxRdfnCQ55ZRT8vKXv3xUtewrgRgAAKDD\nZsyYkWc+8+Bs3Hhhtm3rXB3PfObBmTFjxrCPW7t2ba666qosWrQoPT09uzx2wAEH5Oqrr85JJ52U\nCy64ICtWrMgXvvCF/Mmf/MnOfR566KH80R/9UZJk2bJlAjEAAEBTHHbYYbnttuuzadOmjtYxY8aM\nHHbYYcM+rqenJ9v2kuSPP/749Pf37/x52bJlWbZs2YhqbCeBGAAAYAI47LDDRhRGGTmTagEAANBI\nAjEAAACNJBADAADQSAIxAAAAjSQQAwAA0EgCMQAAAI0kEAMAANBIAjEAAACNJBADAADQSAIxAAAA\njSQQAwAA0EhTOl0AAAAASV9fX1qtVkdr6OrqSnd394iOnT9/fq6//vrcfffdOeqo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7ykpdk+/bteeihh/Lud7/7Cc/10Y9+VCAGAABoiq6ursx8xsz03t2bLdnS\nsTpmPmNmurq6hn1cT09Ptm3b9qSPH3/88env79/58zve8Y4R1dduAjEAAECHdXd358LfvzCtVudG\niJOBYN7d3d3RGsaTQAwAADABdHd3NyqMTgRmmQYAAKCRBGIAAAAaSSAGAACgkQRiAAAAGkkgBgAA\noJEEYgAAABpJIAYAAKCRBGIAAAAaSSAGAACgkQRiAAAAGmlKpwsAYHz19fWl1Wp1uoydurq60t3d\n3ekyAKDjJsJ7dNPelwVigAbp6+vL8hUr0rtlS6dL2WnmtGm5cOnSRr35AsDu+vr6cuXy5env7e1o\nHQfOnJnFF144ovfl+fPn5/rrr8/dd9+do446apfHLr300px33nm55ZZbMnfu3CxdujR33HFH7r33\n3jz66KM54ogj8uY3vznnnHNOnv70p7fr13lKAjFAg7RarfRu2ZJpr3hFug45pNPlpPXww+n90pfS\narUEYgAardVqpb+3N2+YNi2HdnV1pIaHWq38fW/viN+Xr7jiitx6661ZsGBBbr/99p3b77nnnixf\nvjynn3565s6dmyS56667csopp+Rd73pXDj744Hzzm9/MpZdems9//vO544472vY7PZVhBeJSyrIk\ny3bb/J1a6zHtKwmAsdZ1yCGZ/uxnd7qMJMnEGasGgM47tKsrs6ZP71wBo7iK7NBDD81ll12WM888\nM9ddd13mz5+fJFm4cGGmTp2alStX7tx3T6H3uc99bn7/938/X//613PiiSeOuI7hGMmkWt9K8pwk\nhw3++ZW2VgQAAMCkdMYZZ+Tkk0/OOeeck40bN+ZTn/pU1qxZk4svvjizZs3a67FHHHFEaq3ZtGnT\nOFU7skumt9daH2p7JQAAAEx611xzTXp6erJgwYLceeedOfHEE7Nw4cIn7PfYY49l06ZN2bZtW+6+\n++5cOHjv8niNDicjC8TPL6X8MMmjSf45yR/WWte3tywAAAAmo2OOOSZnn312LrnkkkyZMiWrV6/e\n437f+MY3ctJJJ+38+UUvelE+85nPZMaMGeNV6rAD8VeTvDPJ/0kyK8kfJ7m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Pmb2QBgdvQXtp69gbOgtGLkDOl0Ao/ZzSU7OwGyCL/v/27mDGwBB\nKIiC0IH9d+nZw/eiBagQE3amAi9r8oxQVcd1YYKXH3xjWzCeXcEctgUv+WV6Ab33rbW2V1X5Egjj\n2BaMZ1cwh23BO4J4IfelCX8/B6zGtmA8u4I5bAueEcQAAABEcoYYAACASIIYAACASIIYAACASIIY\nAACASIIYAACASIIYAACASIIYAACASIIYAACASIIYAACASCfYJgZri5C0IwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x105e652b0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "from mlxtend.plotting import stacked_barplot\n",
    "\n",
    "fig = stacked_barplot(df, rotation=45, legend_loc='best')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## API"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "## stacked_barplot\n",
      "\n",
      "*stacked_barplot(df, bar_width='auto', colors='bgrcky', labels='index', rotation=90, legend_loc='best')*\n",
      "\n",
      "Function to plot stacked barplots\n",
      "\n",
      "**Parameters**\n",
      "\n",
      "- `df` : pandas.DataFrame\n",
      "\n",
      "    A pandas DataFrame where the index denotes the\n",
      "    x-axis labels, and the columns contain the different\n",
      "    measurements for each row.\n",
      "    bar_width: 'auto' or float (default: 'auto')\n",
      "    Parameter to set the widths of the bars. if\n",
      "    'auto', the width is automatically determined by\n",
      "    the number of columns in the dataset.\n",
      "    colors: str (default: 'bgrcky')\n",
      "    The colors of the bars.\n",
      "    labels: 'index' or iterable (default: 'index')\n",
      "    If 'index', the DataFrame index will be used as\n",
      "    x-tick labels.\n",
      "    rotation: int (default: 90)\n",
      "    Parameter to rotate the x-axis labels.\n",
      "\n",
      "- `legend_loc` : str (default: 'best')\n",
      "\n",
      "    Location of the plot legend\n",
      "    {best, upper left, upper right, lower left, lower right}\n",
      "    No legend if legend_loc=False\n",
      "\n",
      "**Returns**\n",
      "\n",
      "- `fig` : matplotlib.pyplot figure object\n",
      "\n",
      "\n",
      "**Examples**\n",
      "\n",
      "For usage examples, please see\n",
      "    [http://rasbt.github.io/mlxtend/user_guide/plotting/stacked_barplot/](http://rasbt.github.io/mlxtend/user_guide/plotting/stacked_barplot/)\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "with open('../../api_modules/mlxtend.plotting/stacked_barplot.md', 'r') as f:\n",
    "    print(f.read())"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  },
  "toc": {
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
